package com.hopes.bizz.poll.hj212.logic;

import java.util.Date;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 在线状态逻辑
 *
 * @author: xk
 * @since: 1.0.0
 * @version: [1.0.0, 2021/8/24]
 */
public class OnlineStatusLogic {
    /**
     * 监测数据客户端通信时间
     */
    private static final Map<Long, Date> DATA_CLIENT_COMMUNICATION_TIME = new ConcurrentHashMap<>();
    /**
     * 网关客户端通信时间
     */
    private static final Map<Long, Date> GATEWAY_CLIENT_COMMUNICATION_TIME = new ConcurrentHashMap<>();

    /**
     * 获取数采仪客户端通讯时间
     * @return
     */
    public static Map<Long, Date> getDataClientCommunicationTimeMap(){
        return DATA_CLIENT_COMMUNICATION_TIME;
    }

    /**
     * 更新数据客户端通讯时间
     * @param clientId
     * @param date
     */
    public static void setDataClientCommunicationTime(Long clientId, Date date){
        DATA_CLIENT_COMMUNICATION_TIME.put(clientId, date);
    }

    /**
     * 更新网关客户端通讯时间
     * @param clientId
     * @param date
     */
    public static void setGatewayClientCommunicationTime(Long clientId, Date date){
        GATEWAY_CLIENT_COMMUNICATION_TIME.put(clientId, date);
    }

    /**
     * 获取网关客户端通讯时间
     * @return
     */
    public static Map<Long, Date> getGatewayClientCommunicationTimeMap(){
        return GATEWAY_CLIENT_COMMUNICATION_TIME;
    }
}
